package com.itheima.idea;

import java.util.Scanner;

public class Test3Arr {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[] arr = new int[6];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个评委打分");
            arr[i] = sc.nextInt();
            if (arr[i] > 100 ||  arr[i] < 50) {
                i--;
                System.out.println("输入有误");

            }
        }
        int max = arr[0];
        int min = arr[0];
        int num = 0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (min < 50) {
                min = arr[i];
            }
            num += arr[i];
        }
        System.out.println("最终评分为" + (num - max - min) / (arr.length - 2));
    }
}
